<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>DOM测试</title>
    <h1>dom测试</h1>

</head>
<body>
<div id="container">
    <p class="emph" id="p1">第一段</p>
    <p class="normal">第二段</p>
</div>
</body>
</html>

<!--增加一个节点-->
<script type="text/javascript">
    var newOBJ = document.createElement("hr");
    var secOBJ = document.createElement("hr");
    var node = document.getElementById("container");
    node.appendChild(newOBJ);

    var child = document.getElementById("p1");
    var oldcontent = child.innerHTML;
    child.innerHTML = "hello js";

    node.insertBefore(secOBJ,child);
    // node.replaceChild(secOBJ,child);
    // node.removeChild(child);
</script>